import React from 'react';
import ReactDOM from 'react-dom';
//import {Router,Route,Link,IndexRoute,hashHistory} from 'react-router';
import {BrowserRouter as Router,HashRouter,Route,Link,hashHistory,IndexRoute} from 'react-router-dom'
import {createStore,applyMiddleware} from 'redux';
//import { BrowserRouter, HashRouter, Match, Router, Route, Redirect,IndexRoute } from 'react-router';
import {Provider,connect} from 'react-redux';
import Elm from './../components/index/Index.js';
import Waimai from './../components/index/Waimai.js';
import Faxian from './../components/index/Faxian.js';
import DingDan from './../components/index/Dingdan.js';
import Mine from './../components/index/Mine.js';
import thunk from 'redux-thunk';
import Reducer from './Reducer.js'

var store=createStore(Reducer,{list:[]},applyMiddleware(thunk));
store.subscribe(render);

function render(){
	ReactDOM.render(
	<Provider store={store}>		
			<HashRouter  history={hashHistory}>
				{/*<Route path="/" component={Elm}>
					<IndexRoute component={Waimai}></IndexRoute>								
					<Route path='/waimai' component={Waimai}/>
					<Route path='/faxian' component={Faxian}/>
					<Route path='/dingdan' component={DingDan}/>
					<Route path='/mine' component={Mine}/>
				</Route>	*/}	
				<div>
					<Elm/>
					<Route exact path="/" component={Waimai}/>
					<Route path='/waimai' component={Waimai}/>
		            <Route path='/faxian' component={Faxian}/>
					<Route path='/dingdan' component={DingDan}/>
					<Route path='/mine' component={Mine}/>
				</div>
			</HashRouter>
		</Provider>			
		,
		document.querySelector('#wrap')
	)
}
render();